package com.chenjiagou.ordertickets.service.impl;

import com.chenjiagou.ordertickets.entity.BookingSeat;
import com.chenjiagou.ordertickets.dao.BookingSeatDao;
import com.chenjiagou.ordertickets.service.BookingSeatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (BookingSeat)表服务实现类
 *
 * @author makejava
 * @since 2025-06-27 09:25:06
 */
@Service("bookingSeatService")
public class BookingSeatServiceImpl implements BookingSeatService {
    @Resource
    private BookingSeatDao bookingSeatDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BookingSeat queryById(Long id) {
        return this.bookingSeatDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param bookingSeat 实例对象
     * @return 实例对象
     */
    @Override
    public BookingSeat insert(BookingSeat bookingSeat) {
        this.bookingSeatDao.insert(bookingSeat);
        return bookingSeat;
    }

    /**
     * 修改数据
     *
     * @param bookingSeat 实例对象
     * @return 实例对象
     */
    @Override
    public BookingSeat update(BookingSeat bookingSeat) {
        this.bookingSeatDao.update(bookingSeat);
        return this.queryById(bookingSeat.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.bookingSeatDao.deleteById(id) > 0;
    }
}
